c# read next int Like Java

35

c# read next int Like Java -

static int GetInt() {
        int integer = 0;
        int n = Console.Read();
        while (n == ' ' || n == '\n' || n == '\r' || n == '\t' || n == -1)
            n = Console.Read();
        while (n >= '0' && n <= '9') {
            integer = integer * 10 + n - '0';
            n = Console.Read();
        }
        return integer;
    }

Comments

Submit
0 Comments